#!/usr/bin/env bash
set -eu -o pipefail

# expect this to run as NPM script
: "${npm_package_version?}"

should_color=
if [ -t 2 ]; then # if we're sending to a terminal
    should_color=yes
fi

reset=
bold=
if [ -n "${should_color}" ]; then
    reset=$'\033'[0m
    bold=$'\033'[1m
fi

echo >&2 "\
Version updated: ${bold}${npm_package_version}${reset}

Next steps:

  \$ ${bold}git log --stat -p upstream..${reset}  # check your work!

  \$ ${bold}git push --atomic upstream main shared-${npm_package_version}${reset}

  \$ ${bold}npm publish${reset}  # should prompt for an OTP, from your 2FA setup
"
